<template>
	<view class="bgf8">
		<view class="tabchange" v-for="(item,index) in list" :key="index" @click="detail(item.id,index)"> 
			<view class="uniFlex">
				<radio :value="item.id" :checked="index === current" />
				<img class="avatarImg" :src="item.head" mode="widthFix"></img>
				<view class="left_info">
					{{item.name}}
					<text class="sex">{{item.sex}}</text>
					<text>{{item.keshi}}</text>
				</view>
			</view>
			<view>简介：{{item.content}}</view>
		</view>
		<view class="btnStyle" @click="submit">立即提交</view>
	</view>
</template>

<script>
	import {
		gethzys,hzjd
	} from '../../request/api.js'
	export default {
		data() {
			return {
				// baseUrl:'',
				id:'',
				hid:'',
				current:'',
				list:[],
			}
		},
		onLoad(options) {
			// this.baseUrl = getApp().globalData.baseUrlImg;
			this.id = options.id;
			this.getList();
		},
		methods: {
			detail(id,index){
				this.current = index;
				this.hid = id;
			},
			// 列表
			getList() {
				uni.showLoading()
				gethzys().then(res => {
					this.list = res.data;
					uni.hideLoading()
				})
			},
			submit(){
				if (!this.hid) {
					uni.showToast({
						title: '请选择医生',
						icon: "none"
					})
					return
				}
				uni.showLoading()
				hzjd({
					id:this.id,
					hid:this.hid
				}).then(res => {
					uni.hideLoading()
					uni.showToast({
						title:res.msg,
						icon:'none'
					})
					setTimeout(function(){
						uni.navigateBack({
							delta:2
						})
					},800)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background: #f8f8f8;
		padding-top: 20upx;
	}
	.btnStyle{
		margin-top: 120upx;
	}
	.tabchange {
		background: #ffffff;
		margin-bottom: 20upx;
		padding: 30upx;
		line-height: 160%;
		font-size: 30upx;
		.avatarImg {
			width: 96upx;
			height: 96upx;
			border-radius: 50%;
			margin-right: 20upx;
		}
		.left_info{
			font-size: 28upx;
			font-family: Source Han Sans CN;
			font-weight: bold;
			color: #414141;
			
			text {
				font-weight: 200;
			}
			
			.sex {
				padding: 0 24upx;
				margin: 0 24upx;
				border-left: 2upx solid #CCCCCC;
				border-right: 2upx solid #CCCCCC;
			}
		}
		.stu{
			color: #EE2727;
		}
		.stu1{
			color: #009688;
		}
		.stu2{
			color: #008000;
		}
		.stu3{
			color: #FFB800;
		}
		.stu4{
			color: #666666;
		}
		.stu5{
			margin: 0 15upx;
		}
		.stu6-7{
			color: #ffffff;
			font-size: 26upx;
			padding: 3upx 10upx;
			border-radius: 5upx;
		}
		.stu6{
			background: #1E9FFF;
		}
		.stu7{
			background: #DEA512;
		}
		.last{
			color: #6996FE;
			font-size: 24upx;
			border:1px solid #6996FE;
			border-radius: 26upx;
			padding: 10upx 30upx;
			width: 120upx;
			line-height: 100%;
			margin-top: 30upx;
		}
	}
</style>
